-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------

-- Your code here

local image  = display.newImage( "20120928120709_6803_30per.jpg" )

image.height = display.contentWidth
image.width = display.contentHeight

image.x = 320
image.y = 300

local textObject = display.newText( "Hello World!", 50, 50, "Arial", 24 )
textObject:setTextColor( 255,255,255 )
textObject.rotation = 30;

function image:tap( event )
	local r = math.random( 0, 255 )
	local g = math.random( 0, 255 )
	local b = math.random( 0, 255 )
	
	textObject:setTextColor( r, g, b )
	media.playEventSound( "Arrow.wav" )

	image:dispatchEvent( {name="Listen"} )
end

function image:Listen( event )
	textObject.rotation = textObject.rotation + 10;
end

image:addEventListener( "tap" )
image:addEventListener( "Listen" )

image:addEventListener( "tap", function( event ) textObject.x = textObject.x + 10 end )
